//
//  LPRedViewAndLableView.m
//  ShangHaiHuDongApp
//
//  Created by 刘应平 on 2017/6/13.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "LPRedViewAndLableView.h"

@interface LPRedViewAndLableView ()

/** 红色标记 */
@property (nonatomic, strong) UILabel *redLabel;

@end
/**  40  */
@implementation LPRedViewAndLableView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        _bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.width, self.height)];
        _bgView.backgroundColor = [UIColor viewBGGrayColor];
        [self addSubview:_bgView];
        [self addSubview:self.redLabel];
        [self addSubview:self.titleLabel];
    }
    return self;
}

#pragma mark - Getters
- (UILabel *)redLabel{
    if (_redLabel == nil){
        _redLabel = [[UILabel alloc] initWithFrame:CGRectMake(12 * [UIScreen zj_screenWScale], 0, 5 * [UIScreen zj_screenWScale], 18 * [UIScreen zj_screenHScale])];
        _redLabel.backgroundColor = [UIColor themeColor];
        _redLabel.centerY = _bgView.centerY;
    }
    return _redLabel;
}

- (UILabel *)titleLabel{
    if (_titleLabel == nil){
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.redLabel.right + 5 * [UIScreen zj_screenWScale], 0, self.width - self.redLabel.right - 17 * [UIScreen zj_screenWScale], _bgView.height)];
        _titleLabel.textColor = [UIColor textBlackColor];
        _titleLabel.font = [UIFont titleTextFont];
    }
    return _titleLabel;
}

@end
